// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package pica.ui;

import java.io.DataInputStream;
import java.io.IOException;
import javax.microedition.lcdui.Image;

// Referenced classes of package pica.ui:
//            g

public final class c
{

    public c()
    {
    }

    public static void a(DataInputStream datainputstream, int i, g g1)
    {
        int j;
        j = 0;
        boolean flag = false;
        g1.i();
_L2:
        int k;
        short word0 = datainputstream.readShort();
        k = datainputstream.readInt();
        j += 6;
        switch(word0)
        {
        case 8192: 
            b(datainputstream, g1);
            break;

        case 12288: 
            a(datainputstream);
            break;

        case 12289: 
            a(g1);
            break;

        case 12290: 
            b(datainputstream);
            break;

        case 12292: 
            d(datainputstream, g1);
            break;

        case 12293: 
            c(datainputstream, g1);
            break;

        case 12295: 
            a(datainputstream, g1);
            break;

        case 16384: 
            e(datainputstream, g1);
            break;

        case 16385: 
            f(datainputstream, g1);
            break;

        case 16393: 
            g(datainputstream, g1);
            break;

        case 16388: 
            c(datainputstream);
            break;

        default:
            return;
        }
        j += k;
        g1.e((j * g1.f()) / i);
        if(j >= i)
        {
            g1.j();
            g1.a();
            return;
        }
        if(Runtime.getRuntime().freeMemory() < 20000L)
            System.gc();
        if(true) goto _L2; else goto _L1
_L1:
        JVM INSTR dup ;
        Exception exception;
        exception;
        printStackTrace();
    }

    private static void a(DataInputStream datainputstream)
        throws IOException
    {
        datainputstream.readUTF();
    }

    private static void a(DataInputStream datainputstream, g g1)
        throws IOException
    {
        datainputstream.readUTF();
        int i = datainputstream.readInt();
        short word0 = datainputstream.readShort();
        short word1 = datainputstream.readShort();
        datainputstream.readUTF();
        datainputstream.readUTF();
        g1.a(word0, word1, i, null, 0, 0);
        g1.a();
    }

    private static void b(DataInputStream datainputstream, g g1)
        throws IOException
    {
        int i;
        byte abyte0[];
        i = datainputstream.readInt();
        datainputstream.readUTF();
        datainputstream.readUTF();
        int j;
        abyte0 = new byte[j = datainputstream.readInt()];
        for(int k = 0; k < j; k++)
            abyte0[k] = datainputstream.readByte();

        Image image = Image.createImage(abyte0, 0, abyte0.length);
        g1.a(i, image);
        return;
        JVM INSTR dup ;
        Exception exception;
        exception;
        printStackTrace();
    }

    private static void a(g g1)
        throws IOException
    {
        g1.a("", null, 0, (byte)0, (byte)5, 0, 0);
        g1.a();
    }

    private static void c(DataInputStream datainputstream, g g1)
        throws IOException
    {
        String s = datainputstream.readUTF();
        byte byte0 = datainputstream.readByte();
        String s1 = datainputstream.readUTF();
        g1.a(s, s1, 0xffeb66, byte0, (byte)2, 0, 0);
        g1.a();
    }

    private static void b(DataInputStream datainputstream)
        throws IOException
    {
        datainputstream.readByte();
        datainputstream.readByte();
    }

    private static void d(DataInputStream datainputstream, g g1)
        throws IOException
    {
        String s = datainputstream.readUTF();
        g1.a(s, null, 0xffffff, (byte)0, (byte)1, 0, 0);
        g1.a();
    }

    private static void e(DataInputStream datainputstream, g g1)
        throws IOException
    {
        byte byte0 = datainputstream.readByte();
        String s = datainputstream.readUTF();
        String s1 = datainputstream.readUTF();
        byte byte1 = datainputstream.readByte();
        datainputstream.readByte();
        int i = datainputstream.readInt();
        if(byte1 == 35 || byte1 == 42)
            g1.a("", s, s1, i, 0x10000, 100, byte0, 0xffffff, 0, 0);
        else
            g1.a("", s, s1, i, 0, 100, byte0, 0xffffff, 0, 0);
        g1.a();
    }

    private static void f(DataInputStream datainputstream, g g1)
        throws IOException
    {
        byte byte0 = datainputstream.readByte();
        String s = datainputstream.readUTF();
        String s1 = datainputstream.readUTF();
        datainputstream.readByte();
        datainputstream.readByte();
        byte byte1;
        String as[] = new String[byte1 = datainputstream.readByte()];
        String as1[] = new String[byte1];
        for(int i = 0; i < byte1; i++)
        {
            as[i] = datainputstream.readUTF();
            as1[i] = datainputstream.readUTF();
        }

        if(s1.length() == 0)
            s1 = as1[0];
        g1.a("", s, s1, as, null, as1, byte0, 0xffffff, 0, 0);
        g1.a();
    }

    private static void g(DataInputStream datainputstream, g g1)
        throws IOException
    {
        byte byte0 = datainputstream.readByte();
        String s = datainputstream.readUTF();
        String s1 = datainputstream.readUTF();
        datainputstream.readByte();
        g1.a(s, byte0, s1, 0, 0, 0);
        g1.a();
    }

    private static void c(DataInputStream datainputstream)
        throws IOException
    {
        datainputstream.readByte();
        datainputstream.readUTF();
        datainputstream.readUTF();
        datainputstream.readUTF();
    }
}
